/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ronin.dao.api;

import com.ronin.common.model.Kullanici;
import com.ronin.model.Sube;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 *
 * @author esimsek
 */
@Repository
public class SubeDao implements ISubeDao{
    
    @Autowired
    private SessionFactory sessionFactory;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    @Override
    public Sube getSingle(Sube sube) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Sube getSingleById(Long id) {
        List list = getSessionFactory().getCurrentSession()
                .createQuery("from Sube where id=?")
                .setParameter(0, id).list();
        return (Sube) list.get(0);
    }
    
    @Override
    public Sube getSingleOneByNamedQuery(String namedQuery,Object... parameters) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Sube> getList(Sube sube) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Sube> getListByNamedQuery(String namedQuery,Object... parameters) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int getCount(Sube sube) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void add(Sube sube) {
         getSessionFactory().getCurrentSession().save(sube);
    }

    @Override
    public void update(Sube sube) {
         getSessionFactory().getCurrentSession().update(sube);
    }

    @Override
    public void delete(Sube sube) {
        //sube.setDurum(DurumEnum.Silinmis);
        this.update(sube);
    }

    
}
